{load header}
<!--/H-->

<!-- 内容区 -->
<div id="main-content">
    <div id="top-alert" class="fixed alert alert-error" style="display: none;">
        <button class="close fixed" style="margin-top: 4px;">&times;</button>
        <div class="alert-content">这是内容</div>
    </div>
    <div id="main" class="main">
        <!-- nav --><!-- nav -->

        <div class="main-title cf">
            <h2>添加贷款平台</h2>
        </div>
        <div class="tab-wrap">
            <ul class="tab-nav nav">
                <li data-tab="tab1" class="current"><a href="javascript:void(0);">基本信息</a></li>
                <li data-tab="tab2"><a href="javascript:void(0);">平台logo</a></li>
                <li data-tab="tab3"><a href="javascript:void(0);">平台描述</a></li>
                <li data-tab="tab4"><a href="javascript:void(0);">其他信息</a></li>
            </ul>
            <div class="tab-content">
                <form action="" method="post" class="form-horizontal">
                    <div id="tab1" class="tab-pane in tab1">
                        <div class="form-item cf">
                            <label class="item-label">所属金额类型<span class="check-tips"></span></label>
                            <div class="controls">
                                <select name="amount_id">
                                    <!--{loop $amount_type $val}-->
                                    <option {if $item[
                                    'amount_id'] == $val['id']}selected{/if}
                                    value="{$val['id']}">{$val['title']}</option>
                                    <!--{/loop}-->
                                </select>
                            </div>

                        </div>
                        <div class="form-item cf">
                            <label class="item-label">所属利率类型<span class="check-tips"></span></label>
                            <div class="controls">
                                <select name="rate_id">
                                    <!--{loop $rate_type $val}-->
                                    <option value="{$val['id']}" {if $item[
                                    'rate_id'] == $val['id']}selected{/if}>{$val['title']}</option>
                                    <!--{/loop}-->
                                </select>
                            </div>

                        </div>
                        <div class="form-item cf">
                            <label class="item-label">所属期限类型<span class="check-tips"></span></label>
                            <div class="controls">
                                <select name="period_id">
                                    <!--{loop $period_type $val}-->
                                    <option {if $item[
                                    'period_id'] == $val['id']}selected{/if}
                                    value="{$val['id']}">{$val['title']}</option>
                                    <!--{/loop}-->
                                </select>
                            </div>

                        </div>
                        <div class="form-item cf">
                            <label class="item-label">平台类型<span class="check-tips"></span></label>
                            <div class="controls">
                                <!--{loop $lend_type $val}-->
                                <input type="checkbox" name="lend_id[]" value="{$val['id']}"
                                <!--{if (in_array($val['id'],$item['lend_id']))}-->checked<!--{/if}-->>{$val['title']}
                                <!--{/loop}-->
                            </div>

                        </div>
                        <div class="form-item cf">
                            <label class="item-label">平台中文名称<span class="check-tips">（用于前台显示）</span></label>
                            <div class="controls name_name">
                                <input type="text" id="name_ch" class="text input-large" name="name_ch"
                                       value="{$item['name_ch']}">
                            </div>
                        </div>
                        <div class="form-item cf">
                            <label class="item-label">平台英文名称<span class="check-tips">（用于前台显示）</span></label>
                            <div class="controls">
                                <input type="text" id="name_en" class="text input-large" name="name_en"
                                       value="{$item['name_en']}">
                            </div>
                        </div>
                        <div class="form-item cf">
                            <label class="item-label">平台贷款利率<span class="check-tips">（以天为参考单位）</span></label>
                            <div class="controls">
                                <input type="text" class="text input-small" name="rate" value="{$item['rate']}">
                            </div>
                        </div>
                        <div class="form-item cf">
                            <label class="item-label">贷款期限范围<span class="check-tips"></span></label>
                            <div class="controls">
                                <input type="text" class="text input-small" name="period_area"
                                       value="{$item['period_area']}">
                            </div>
                        </div>
                        <!--<div class="form-item cf">
                            <label class="item-label">贷款金额范围<span class="check-tips"></span></label>
                            <div class="controls">
                                <input type="text" class="text input-small" name="amount_area"
                                       value="{$item['amount_area']}">
                            </div>
                        </div>
                        <div class="form-item cf">
                            <label class="item-label">贷款金额范围（别名）<span class="check-tips"></span></label>
                            <div class="controls">
                                <input type="text" class="text input-small" name="amount_area_alisa"
                                       value="{$item['amount_area_alisa']}">
                            </div>
                        </div>-->
                        <div class="form-item cf">
                            <label class="item-label">贷款金额起始值<span class="check-tips"></span></label>
                            <div class="controls">
                                <input type="text" class="text input-small" name="amount_first" value="{$item['amount_first']}">元
                                <span> ~ </span>
                                <input type="text" class="text input-small" name="amount_over" value="{$item['amount_over']}">元
                            </div>
                        </div>
                        <div class="form-item cf">
                            <label class="item-label">平台列表页小提示信息<span class="check-tips"></span></label>
                            <div class="controls">
                                <input type="text" class="text input-large" name="tip_list" value="{$item['tip_list']}">
                            </div>
                        </div>
                        <div class="form-item cf">
                            <label class="item-label">平台详情页小提示信息<span class="check-tips"></span></label>
                            <div class="controls">
                                <input type="text" class="text input-large" name="tip_detail"
                                       value="{$item['tip_detail']}">
                            </div>
                        </div>
                        <div class="form-item cf">
                            <label class="item-label">平台最快放款时间<span class="check-tips"></span></label>
                            <div class="controls">
                                <input type="text" class="text input-large" name="tip_lending_fast"
                                       value="{$item['tip_lending_fast']}">
                            </div>
                        </div>
                        <div class="form-item">
                            <label class="item-label">排序<span class="check-tips">（从大到小排序）</span></label>
                            <div class="controls">
                                <input type="text" class="text input-small" name="sort" value="{$item['sort']}">
                            </div>
                        </div>

                        <!--<div class="form-item">
                            <label class="item-label">贷款状态<span class="check-tips"></span></label>
                            <div class="controls">
                                <label class="radio"><input type="radio" name="status" {if $item['status'] ==
                                    0}checked{/if} value="0">审核中</label>
                                <label class="radio"><input type="radio" name="status" {if $item['status'] ==
                                    1}checked{/if} value="1">贷款中</label>
                                <label class="radio"><input type="radio" name="status" {if $item['status']
                                    ==2}checked{/if} value="2">贷款失败</label>
                            </div>
                        </div>-->
                    </div>
                    <div id="tab2" class="tab-pane tab2">

                        <div class="form-item">
                            <label class="item-label">列表页位置logo<span class="check-tips"></span></label>
                            <div class="controls">
                                <input type="file" id="upload_picture_cover_id">
                                <input type="hidden" name="logo_list" id="cover_id_cover_id"
                                       value="{$item['logo_list']}"/>
                                <div class="upload-img-box"><!--{if ($item['logo_list'])!='' }-->
                                    <div class="upload-pre-item"><img src="{$item['logo_list']}"/></div><!--{/if}-->
                                </div>
                            </div>
                            <script type="text/javascript"
                                    src="{eval echo base_url()}static/uploadify/jquery.uploadify.min.js"></script>
                            <script type="text/javascript">
                                //上传图片
                                /* 初始化上传插件 */
                                $("#upload_picture_cover_id").uploadify({
                                    "height": 30,
                                    "swf": "{eval echo base_url()}static/uploadify/uploadify.swf",
                                    "fileObjName": "picture",
                                    "buttonText": "上传图片",
                                    "uploader": "http://static.tan66.com/upload/picture.html",//http://static.tan66.com/upload/picture.html
                                    //'formData' : {"action": "upload", "sid" : ""},
                                    "width": 120,
                                    'removeTimeout': 1,
                                    'fileTypeExts': '*.jpg; *.png; *.gif;',
                                    "onUploadSuccess": uploadPicturecover_id,
                                    'onFallback': function () {
                                        alert('未检测到兼容版本的Flash.');
                                    }
                                });
                                function uploadPicturecover_id(file, data) {
                                    var data = $.parseJSON(data);
                                    var src = '';
                                    if (data.status) {
                                        $("#cover_id_cover_id").val(data.id);
                                        src = data.url || '' + data.path
                                        $("#cover_id_cover_id").parent().find('.upload-img-box').html(
                                                '<div class="upload-pre-item"><img src="' + src + '"/></div>'
                                        );

                                    } else {
                                        updateAlert(data.info);
                                        setTimeout(function () {
                                            $('#top-alert').find('button').click();
                                            //$(that).removeClass('disabled').prop('disabled',false);
                                        }, 1500);
                                    }
                                }
                            </script>
                        </div>
                        <div class="form-item">
                            <label class="item-label">详情页位置logo<span class="check-tips"></span></label>
                            <div class="controls">
                                <input type="file" id="upload_picture_cover_id_05">
                                <input type="hidden" name="logo_detail" id="cover_id_cover_id_05"
                                       value="{$item['logo_detail']}"/>
                                <div class="upload-img-box"><!--{if ($item['logo_detail'])!='' }-->
                                    <div class="upload-pre-item"><img src="{$item['logo_detail']}"/></div><!--{/if}-->
                                </div>
                            </div>

                            <script type="text/javascript">
                                //上传图片
                                /* 初始化上传插件 */
                                $("#upload_picture_cover_id_05").uploadify({
                                    "height": 30,
                                    "swf": "{eval echo base_url()}static/uploadify/uploadify.swf",
                                    "fileObjName": "picture",
                                    "buttonText": "上传图片",
                                    "uploader": "http://static.tan66.com/upload/picture.html",//http://static.tan66.com/upload/picture.html
                                    //'formData' : {"action": "upload", "sid" : ""},
                                    "width": 120,
                                    'removeTimeout': 1,
                                    'fileTypeExts': '*.jpg; *.png; *.gif;',
                                    "onUploadSuccess": uploadPicturecover_id_05,
                                    'onFallback': function () {
                                        alert('未检测到兼容版本的Flash.');
                                    }
                                });
                                function uploadPicturecover_id_05(file, data) {
                                    var data = $.parseJSON(data);
                                    var src = '';
                                    if (data.status) {
                                        $("#cover_id_cover_id_05").val(data.id);
                                        src = data.url || '' + data.path
                                        $("#cover_id_cover_id_05").parent().find('.upload-img-box').html(
                                                '<div class="upload-pre-item"><img src="' + src + '"/></div>'
                                        );

                                    } else {
                                        updateAlert(data.info);
                                        setTimeout(function () {
                                            $('#top-alert').find('button').click();
                                            //$(that).removeClass('disabled').prop('disabled',false);
                                        }, 1500);
                                    }
                                }
                            </script>
                        </div>
                        <div class="form-item">
                            <label class="item-label">个人中心页面logo<span class="check-tips"></span></label>
                            <div class="controls">
                                <input type="file" id="upload_picture_cover_id_02">
                                <input type="hidden" name="logo_icon" id="cover_id_cover_id_02"
                                       value="{$item['logo_icon']}"/>
                                <div class="upload-img-box"><!--{if ($item['logo_icon'])!='' }-->
                                    <div class="upload-pre-item"><img src="{$item['logo_icon']}"/></div><!--{/if}-->
                                </div>
                            </div>

                            <script type="text/javascript">
                                //上传图片
                                /* 初始化上传插件 */
                                $("#upload_picture_cover_id_02").uploadify({
                                    "height": 30,
                                    "swf": "{eval echo base_url()}static/uploadify/uploadify.swf",
                                    "fileObjName": "picture",
                                    "buttonText": "上传图片",
                                    "uploader": "http://static.tan66.com/upload/picture.html",//http://static.tan66.com/upload/picture.html
                                    //'formData' : {"action": "upload", "sid" : ""},
                                    "width": 120,
                                    'removeTimeout': 1,
                                    'fileTypeExts': '*.jpg; *.png; *.gif;',
                                    "onUploadSuccess": uploadPicturecover_id_02,
                                    'onFallback': function () {
                                        alert('未检测到兼容版本的Flash.');
                                    }
                                });
                                function uploadPicturecover_id_02(file, data) {
                                    var data = $.parseJSON(data);
                                    var src = '';
                                    if (data.status) {
                                        $("#cover_id_cover_id_02").val(data.id);
                                        src = data.url || '' + data.path
                                        $("#cover_id_cover_id_02").parent().find('.upload-img-box').html(
                                                '<div class="upload-pre-item"><img src="' + src + '"/></div>'
                                        );

                                    } else {
                                        updateAlert(data.info);
                                        setTimeout(function () {
                                            $('#top-alert').find('button').click();
                                            //$(that).removeClass('disabled').prop('disabled',false);
                                        }, 1500);
                                    }
                                }
                            </script>
                        </div>
                        <div class="form-item">
                            <label class="item-label">列表页面logo小方块<span class="check-tips"></span></label>
                            <div class="controls">
                                <input type="file" id="upload_picture_cover_id_03">
                                <input type="hidden" name="logo_small" id="cover_id_cover_id_03"
                                       value="{$item['logo_small']}"/>
                                <div class="upload-img-box"><!--{if ($item['logo_small'])!='' }-->
                                    <div class="upload-pre-item"><img src="{$item['logo_small']}"/></div><!--{/if}-->
                                </div>
                            </div>

                            <script type="text/javascript">
                                //上传图片
                                /* 初始化上传插件 */
                                $("#upload_picture_cover_id_03").uploadify({
                                    "height": 30,
                                    "swf": "{eval echo base_url()}static/uploadify/uploadify.swf",
                                    "fileObjName": "picture",
                                    "buttonText": "上传图片",
                                    "uploader": "http://static.tan66.com/upload/picture.html",//http://static.tan66.com/upload/picture.html
                                    //'formData' : {"action": "upload", "sid" : ""},
                                    "width": 120,
                                    'removeTimeout': 1,
                                    'fileTypeExts': '*.jpg; *.png; *.gif;',
                                    "onUploadSuccess": uploadPicturecover_id_03,
                                    'onFallback': function () {
                                        alert('未检测到兼容版本的Flash.');
                                    }
                                });
                                function uploadPicturecover_id_03(file, data) {
                                    var data = $.parseJSON(data);
                                    var src = '';
                                    if (data.status) {
                                        $("#cover_id_cover_id_03").val(data.id);
                                        src = data.url || '' + data.path
                                        $("#cover_id_cover_id_03").parent().find('.upload-img-box').html(
                                                '<div class="upload-pre-item"><img src="' + src + '"/></div>'
                                        );

                                    } else {
                                        updateAlert(data.info);
                                        setTimeout(function () {
                                            $('#top-alert').find('button').click();
                                            //$(that).removeClass('disabled').prop('disabled',false);
                                        }, 1500);
                                    }
                                }
                            </script>
                        </div>

                    </div>


                    <div id="tab3" class="tab-pane tab3">
                        <div class="form-item cf">
                            <label class="item-label">平台描述<span class="check-tips">（平台简介）</span></label>
                            <div class="controls">
                                <label class="textarea input-large">
                                    <textarea name="description">{$item['description']}</textarea>
                                </label>
                            </div>
                        </div>
                        <div class="form-item cf">
                            <label class="item-label">平台贷款申请条件<span class="check-tips">（申请条件）</span></label>
                            <div class="controls">
                                <label class="textarea input-large">
                                    <textarea name="apply_conditions">{$item['apply_conditions']}</textarea>
                                </label>
                            </div>
                        </div>
                        <div class="form-item cf">
                            <label class="item-label">平台贷款所需材料<span class="check-tips">（所需材料）</span></label>
                            <div class="controls">
                                <label class="textarea input-large">
                                    <textarea name="apply_materials">{$item['apply_materials']}</textarea>
                                </label>
                            </div>
                        </div>

                    </div>
                    <div id="tab4" class="tab-pane tab4">
                        <div class="form-item cf">
                            <label class="item-label">贷款金额范围数组<span
                                    class="check-tips">（格式如：2000,5000,6000）</span></label>
                            <div class="controls">
                                <input type="text" class="text input-large" name="amount_area_arr"
                                       value="{$item['amount_area_arr']}">
                            </div>
                        </div>
                        <div class="form-item cf">
                            <label class="item-label">贷款期限范围数组<span class="check-tips">（格式如：1天,2天,3天）</span></label>
                            <div class="controls">
                                <input type="text" class="text input-large" name="period_area_arr"
                                       value="{$item['period_area_arr']}">
                            </div>
                        </div>
                        <div class="form-item cf">
                            <label class="item-label">h5推广注册页面链接<span class="check-tips"></span></label>
                            <div class="controls">
                                <input type="text" class="text input-large" name="h5_reg_url"
                                       value="{$item['h5_reg_url']}">
                            </div>
                        </div>
                        <!--{loop $plat_list $plat}-->
                        <div class="form-item cf">
                            <label class="item-label">h5推广注册页面链接（来源:{$plat['name']}）<span class="check-tips"></span></label>
                            <div class="controls">
                                <input type="text" class="text input-large" name="plat_url[{$plat['value']}]" value="{$item['plat_reg_url'][$plat['value']]}">
                            </div>
                        </div>
                        <!--{/loop}-->
                        <div class="form-item cf">
                            <label class="item-label">联系电话<span class="check-tips"></span></label>
                            <div class="controls">
                                <input type="text" class="text input-large" name="contact_number"
                                       value="{$item['contact_number']}">
                            </div>
                        </div>

                    </div>
                    <div class="form-item cf">
                        <input type="hidden" value="{$item['id']}" name="id"/>
                        <button class="btn submit-btn ajax-post" id="submit" type="submit"
                                target-form="form-horizontal">确 定
                        </button>
                        <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
                    </div>
                </form>
            </div>
        </div>
        <link href="{eval echo base_url()}static/datetimepicker/css/datetimepicker.css" rel="stylesheet"
              type="text/css">
        <link href="{eval echo base_url()}static/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
        <script type="text/javascript"
                src="{eval echo base_url()}static/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
        <script type="text/javascript"
                src="{eval echo base_url()}static/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
                charset="UTF-8"></script>
        <script type="text/javascript">
            $(function () {
                $('#sign_date').datetimepicker({
                    format: 'yyyy-mm-dd',
                    language: "zh-CN",
                    minView: 2,
                    autoclose: true
                });

                $('#datetimepicker').datetimepicker({
                    format: 'yyyy-mm-dd',
                    language: "zh-CN",
                    minView: 2,
                    autoclose: true,
                    pickerPosition: 'bottom-left'
                })
                $(".borrow_child").click(function () {
                    var name_num = 0;
                    name_num = $(".name_name").find("input").length;
                    name_num = name_num + 1;
                    $(".name_name").append("<br/><input type='text' class='text input-large' name='name" + name_num + "' value=''>");
                    $(".acount_acount").append("<br/><input type=\"text\" onkeyup=\"this.value=this.value.replace(/[^0-9.}]/g,'')\" onafterpaste=\"this.value=this.value.replace(/[^0-9.}]/g,'')\" class=\"text input-middle\" name=\"account" + name_num + "\" value=\"\">元");
                });
                $("select[name='borrow_style'] >option").click(function () {
                    var type = $(this).attr("value");
                    if (type == "endday") {
                        $("#borrow_period_time").html("天");
                    } else {
                        $("#borrow_period_time").html("个月");
                    }
                });

            })
        </script>
        <!--F-->{load footer}
        <script type="text/javascript">
            showTab();
        </script>